package com.globalresources.business.inface;

import java.util.List;

import com.globalresources.po.Friend;
import com.globalresources.po.Message;
import com.globalresources.po.MessageReceiver;

/**
 * @author aaron.lu(luzhiyuan) E-mail:atyuan.lu@gmail.com
 * @since 创建时间：Aug 6, 2009 3:33:42 PM
 */
public interface IMessageService {

	/**
	 * <p>
	 * 获取好友列表
	 * 
	 * @author aaron.lu(luzhiyuan)
	 * @param nickName
	 * @param onwerName
	 * @param isInBacklist
	 * @param pageSize
	 * @param startRow
	 * @return
	 */
	public List<Friend> getFriends(String nickName, String onwerName,
			Byte isInBacklist, int pageSize, int startRow);

	/**
	 * <P>
	 * 查询好友总纪录数
	 * 
	 * @author aaron.lu(luzhiyuan)
	 * @param onwerName
	 * @param isInBackList
	 * @return
	 */
	public Long countFriends(String onwerName, Byte isInBackList);

	/**
	 * <P>
	 * 保存或更新好友信息
	 * 
	 * @author aaron.lu(luzhiyuan)
	 * @param friend
	 */
	public void saveOrUpdateFriend(Friend friend);

	/**
	 * <P>
	 * 删除好友信息
	 * 
	 * @author aaron.lu(luzhiyuan)
	 * @param friend
	 */
	public void deleteFriend(Friend friend);

	/**
	 * <P>
	 * 查询好友信息
	 * 
	 * @author aaron.lu(luzhiyuan)
	 * @param id
	 * @return
	 */
	public Friend getFriend(Integer id);

	/**
	 * <p>
	 * 保存消息
	 * 
	 * @author aaron.lu(luzhiyuan)
	 * @param message
	 */
	public void saveMessage(Message message);

	/**
	 * <p>
	 * 查询消息实体
	 * 
	 * @author aaron.lu(luzhiyuan)
	 * @param username
	 * @param isDelete
	 * @param pagesize
	 * @param startrow
	 * @return
	 */
	public List<Message> getMessages(String username, Byte isDelete,
			int pagesize, int startrow);

	/**
	 * <p>
	 * 查询消息总纪录数
	 * 
	 * @author aaron.lu(luzhiyuan)
	 * @param username
	 * @param isDelete
	 * @return
	 */
	public int countMessages(String username, Byte isDelete);

	/**
	 * <p>
	 * 查询消息接受者信息
	 * 
	 * @author aaron.lu(luzhiyuan)
	 * @param username
	 * @param isReceive
	 * @param isRead
	 * @param isDelete
	 * @param isDeleteMessage
	 * @param pageSize
	 * @param startRow
	 * @return
	 */
	public List<MessageReceiver> getMessageReceiver(String username,
			Byte isReceive, Byte isRead, Byte isDelete, Byte isDeleteMessage,
			int pageSize, int startRow);

	/**
	 * <p>
	 * 查询消息接受者总纪录数
	 * 
	 * @author aaron.lu(luzhiyuan)
	 * @param username
	 * @param isReceive
	 * @param isRead
	 * @param isDelete
	 * @param isDeleteMessage
	 * @return
	 */
	public int countMessageReceiver(String username, Byte isReceive,
			Byte isRead, Byte isDelete, Byte isDeleteMessage);

	/**
	 * <p>
	 * 查询消息实体
	 * 
	 * @author aaron.lu(luzhiyuan)
	 * @param id
	 * @return
	 */
	public Message getMessage(Integer id);

	/*
	 * 删除消息 <p>删除消息实体 @author songduanlei@gmail.com @param Object Mesage
	 * @return boolean
	 */
	public void deleteMessage(Message message);

	/*
	 * 通过ID删除消息 <p>通过删除消息实体 @author songduanlei@gmail.com @param Integer Id
	 * @return boolean
	 */
	public void deleteMessageById(Integer id);

	/**
	 * <p>
	 * 查询消息接受者实体
	 * 
	 * @author aaron.lu(luzhiyuan)
	 * @param id
	 * @return
	 */
	public MessageReceiver getMessageReceiver(Integer id);

	/**
	 * <p>
	 * 保存消息接受者实体
	 * 
	 * @author aaron.lu(luzhiyuan)
	 * @param messageReceiver
	 */
	public void saveMessageReceiver(MessageReceiver messageReceiver);

	/**
	 * <p>
	 * 查询匹配后的消息实体
	 * 
	 * @author liming.yu(yulm88@gmail.com)
	 * @param keyWord
	 *            匹配关键字
	 * @param username
	 * @param isDelete
	 * @param pagesize
	 * @param startrow
	 * @return
	 */
	public List<Message> getMatchingMessages(String keyWord, String username,
			Byte isDelete, int pagesize, int startrow);

	/**
	 * <p>
	 * 查询匹配后的消息总纪录数
	 * 
	 * @author liming.yu(yulm88@gmail.com)
	 * @param keyWord
	 * @param username
	 * @param isDelete
	 * @return
	 */
	public int countMatchingMessages(String keyWord, String username,
			Byte isDelete);

	/**
	 * <p>
	 * 查询匹配后的消息接受者信息
	 * 
	 * @author liming.yu(yulm88@gmail.com)
	 * @param keyWord
	 * @param username
	 * @param isReceive
	 * @param isRead
	 * @param isDelete
	 * @param isDeleteMessage
	 * @param pageSize
	 * @param startRow
	 * @return
	 */
	public List<MessageReceiver> getMatchingMessageReceiver(String keyWord,
			String username, Byte isReceive, Byte isRead, Byte isDelete,
			Byte isDeleteMessage, int pageSize, int startRow);

	/**
	 * <p>
	 * 查询消息接受者总纪录数
	 * 
	 * @author liming.yu(yulm88@gmail.com)
	 * @param keyWord
	 * @param username
	 * @param isReceive
	 * @param isRead
	 * @param isDelete
	 * @param isDeleteMessage
	 * @return
	 */
	public int countMatchingMessageReceiver(String keyWord, String username,
			Byte isReceive, Byte isRead, Byte isDelete, Byte isDeleteMessage);

}
